package com.fms.gui.emailer;

import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.fms.data.messaging.EmailOptions;

public class EmailForm extends JFrame
{

	private static final long	serialVersionUID	= 6787079592429642086L;

	public EmailForm(EmailOptions options,
					 JComponent destinationEntry,
					 JComponent flowSheetSelect,
					 JComponent subjectEntry,
					 JComponent messageEntry,
					 JComponent sendButton)
	{
		this.setLayout(new BorderLayout());

		GridLayout gridLayout = new GridLayout(0, 1);
		gridLayout.setVgap(10);
		JPanel topData = new JPanel(gridLayout);
		topData.add(new JLabel("This program is currently configured for: " + options.getName()));
		topData.add(group(new JLabel("To:"), destinationEntry));
		topData.add(group(new JLabel("Select Flowsheet:"), flowSheetSelect));
		topData.add(group(new JLabel("Subject:"), subjectEntry));
		this.add(topData, BorderLayout.NORTH);
		this.add(group(new JLabel("Message:"), messageEntry), BorderLayout.CENTER);
		
		JPanel bottom = new JPanel(new BorderLayout());		
		bottom.add(sendButton, BorderLayout.EAST);
		this.add(bottom, BorderLayout.SOUTH);
		this.setName("Email a FlowSheet");
	}
	
	public JPanel group(JComponent comp, JComponent text)
	{
		JPanel panel = new JPanel(new BorderLayout());
		
		panel.add(comp, BorderLayout.NORTH);
		panel.add(text, BorderLayout.CENTER);
		return panel;
	}
					 
	
}
